package com.services;

import com.dao.MemberDao;
import com.model.Member;
import com.model.OrderNew;
import com.utils.UUIDGenerator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by yangziqiang on 16-9-12.
 */
@Service
public class MemberServices {

    @Autowired private MemberDao memberDao;

    /**
     * 添加用户
     * @param mobile
     * @param pwd
     * @return
     */
    public int addMember(String mobile,String pwd){
        Member member = new Member();
        member.setId(UUIDGenerator.generate());
        member.setMobile(mobile);
        member.setNickname(mobile);
        member.setPhone(mobile);
        member.setPassword(pwd);
        return  memberDao.addMember(member);
    }

    /**
     * 查询
     * @param
     * @return
     */
    public Member queryByMember(String mobile){
        return  memberDao.queryByMember(mobile);
    }

    public Member queryMemBerByid(String id){
        return  memberDao.queryMemBerByid(id);
    }



    public int plinsert(List<Member> members){
     return    memberDao.plinsert(members);
    }


    public List<OrderNew> finList() {
       return memberDao.finList();
    }
}
